Name: 'WorkspacesView',
_init: function(workspaces) {
- this.actor = new St.Widget({ style_class: 'workspaces-view' });
+ this.actor = new St.Widget({ style_class: 'workspaces-view',
+ reactive: true });
// The actor itself isn't a drop target, so we don't want to pick on its area
this.actor.set_size(0, 0);
this._notifyOpacityId = 0;
this._swipeScrollBeginId = 0;
this._swipeScrollEndId = 0;
+ this._scrollEventId = 0;
},
_onPan: function(action) {
this._restackedNotifyId =
Main.overview.connect('windows-restacked',
Lang.bind(this, this._onRestacked));
+ if (this._scrollEventId == 0)
+ this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
},
zoomFromOverview: function() {
Main.overview.disconnect(this._restackedNotifyId);
this._restackedNotifyId = 0;
}
+ if (this._scrollEventId > 0) {
+ Main.overview.disconnect(this._scrollEventId);
+ this._scrollEventId = 0;
+ }
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].destroy();
this._workspaces.push(monitorWorkspaces);
let view = new WorkspacesView(monitorWorkspaces);
+ view.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
if (this._workspacesOnlyOnPrimary || i == this._primaryIndex) {
this._scrollAdjustment = view.scrollAdjustment;
this._scrollAdjustment.connect('notify::value',
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].updateWorkspaces(oldNumWorkspaces,
newNumWorkspaces);
+ },
+
+ _onScrollEvent: function(actor, event) {
+ if (!this.actor.mapped)
+ return false;
+ switch (event.get_scroll_direction()) {
+ case Clutter.ScrollDirection.UP:
+ Main.wm.actionMoveWorkspace(Meta.MotionDirection.UP);
+ return true;
+ case Clutter.ScrollDirection.DOWN:
+ Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
+ return true;
+ }
+ return false;
}
});
Signals.addSignalMethods(WorkspacesDisplay.prototype);